#include <iostream>
#include <memory>
#include <vector>

using namespace std;

int main() {
  vector<shared_ptr<int>> vec_ptr;
  int n = 3;
  vec_ptr.resize(n);

  for (int i = 0; i < n; ++i) {
    vec_ptr[i] = make_shared<int>(i);
  }

  for (int i = 0; i < n; ++i) {
    cout << *vec_ptr[i] << endl;
  }

  vec_ptr.clear();
  vec_ptr.resize(n);
  for (int i = 0; i < n; ++i) {
    if (vec_ptr[i]) {
      cout << "fei kong" << endl;
    } else {
      cout << "kong" << endl;
    }
  }

  vector<shared_ptr<vector<int>>> vp;
  vp.resize(n);

  for (int i = 0; i < n; ++i) {
    vp[i] = make_shared<vector<int>>(n);
    for (int j = 0; j < n; ++j)
      (*vp[i])[j] = i;
  }

  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < vp[i]->size(); ++j)
      cout << (*vp[i])[j] << endl;
  }

  return 0;
}